package com.sporadic.backstage.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sporadic.backstage.entity.DishesConfig;
import com.sporadic.backstage.mapper.DishesConfigMapper;
import com.sporadic.backstage.service.DishesConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DishesConfigServiceImpl implements DishesConfigService {
    @Autowired
    private DishesConfigMapper dishesConfigMapper;

    /**
     * 查询商家所有菜品配置
     * @param merchantId 商家编号
     * @return
     */
    @Override
    public List<DishesConfig> selDishesConfigAll(Integer merchantId) {

        return dishesConfigMapper.selDishesConfigAll(merchantId);
    }
    /**
     * 修改商家菜品配置
     * @param dishesConfig 配置信息详情
     * @return 受影响的行数
     */
    @Override
    public Integer upDishesConfig(DishesConfig dishesConfig) {
        QueryWrapper<DishesConfig> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("dcof_id",dishesConfig.getDcof_id());
        queryWrapper.eq("dcof_merchantId",dishesConfig.getDcof_merchantId());
        return dishesConfigMapper.update(dishesConfig,queryWrapper);
    }
}
